-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(synapse-interface): format portfolio balances #2832
Conversation
WalkthroughA series of updates have been made across multiple files to improve consistency and functionality in the Synapse Interface project. Key enhancements include the unified importation of Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Updated balance formatting logic in
packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx
usingformatAmount
- Improved balance formatting in
packages/synapse-interface/components/Portfolio/components/PortfolioTokenVisualizer.tsx
withgetParsedBalance
andformatAmount
- Passed
portfolioChainId
prop toPortfolioTokenVisualizer
inpackages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx
- Formatted
maxBridgeableBalance
inpackages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
usingformatAmount
- Added console log for
maxBridgeableBalance
inpackages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
for debugging
4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (3)
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (1)
Line range hint
37-44
: Omit the Else ClauseThe else clause can be omitted because previous branches return early. This improves readability.
- } else if (isGasToken && isGasEstimateLoading) { + } + if (isGasToken && isGasEstimateLoading) {Tools
Biome
[error] 29-44: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 37-44: This else clause can be omitted because previous branches break early.
(lint/style/noUselessElse)
packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx (2)
Line range hint
103-103
: Addrel="noreferrer"
to External LinkOpening external links in new tabs without
rel="noreferrer"
is a security risk.- <a target="_blank" className="underline" href={TWITTER_URL}> + <a target="_blank" rel="noreferrer" className="underline" href={TWITTER_URL}>
Line range hint
107-107
: Addrel="noreferrer"
to External LinkOpening external links in new tabs without
rel="noreferrer"
is a security risk.- <a target="_blank" className="underline" href={DISCORD_URL}> + <a target="_blank" rel="noreferrer" className="underline" href={DISCORD_URL}>
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx (3 hunks)
- packages/synapse-interface/components/Portfolio/components/PortfolioTokenVisualizer.tsx (7 hunks)
- packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx (1 hunks)
- packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (3 hunks)
Additional context used
Biome
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
[error] 29-44: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 37-44: This else clause can be omitted because previous branches break early.
(lint/style/noUselessElse)
packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx
[error] 103-103: Avoid using target="_blank" without rel="noreferrer".
Opening external links in new tabs without rel="noreferrer" is a security risk. See the explanation for more details.
Safe fix: Add the rel="noreferrer" attribute.(lint/a11y/noBlankTarget)
[error] 107-107: Avoid using target="_blank" without rel="noreferrer".
Opening external links in new tabs without rel="noreferrer" is a security risk. See the explanation for more details.
Safe fix: Add the rel="noreferrer" attribute.(lint/a11y/noBlankTarget)
Additional comments not posted (15)
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (2)
3-3
: Import Statement ApprovedThe import statement for
formatAmount
is correctly added.
41-41
: Correct Usage offormatAmount
The usage of
formatAmount
to formatmaxBridgeableBalance
is correct.packages/synapse-interface/components/Portfolio/components/GasTokenAsset.tsx (3)
5-6
: Import Statements ApprovedThe import statements for
HoverTooltip
andformatAmount
are correctly added.
17-17
: Correct Usage ofgetParsedBalance
The usage of
getParsedBalance
to parse the balance is correct.
42-42
: Correct Usage offormatAmount
The usage of
formatAmount
to formatparsedBalance
is correct.packages/synapse-interface/components/Portfolio/components/PortfolioTokenVisualizer.tsx (9)
3-5
: Import Statements ApprovedThe import statements for
HoverTooltip
,getParsedBalance
, andformatAmount
are correctly added.
9-12
: New PropportfolioChainId
ApprovedThe addition of
portfolioChainId
as a prop is correctly implemented.
25-28
: Correct Usage ofgetParsedBalance
for First TokenThe usage of
getParsedBalance
to parse the balance of the first token is correct.
29-32
: Correct Usage ofgetParsedBalance
for Second TokenThe usage of
getParsedBalance
to parse the balance of the second token is correct.
55-55
: Correct Usage offormatAmount
for First TokenThe usage of
formatAmount
to format the balance of the first token is correct.
72-72
: Correct Usage offormatAmount
for Single TokenThe usage of
formatAmount
to format the balance of a single token is correct.
81-81
: Correct Usage offormatAmount
for Second TokenThe usage of
formatAmount
to format the balance of the second token is correct.
103-106
: Correct Usage ofgetParsedBalance
for Additional TokensThe usage of
getParsedBalance
to parse the balance of additional tokens is correct.
109-109
: Correct Usage offormatAmount
for Additional TokensThe usage of
formatAmount
to format the balance of additional tokens is correct.packages/synapse-interface/components/Portfolio/components/SingleNetworkPortfolio.tsx (1)
91-93
: Correct Passing ofportfolioChainId
PropThe
portfolioChainId
prop is correctly passed toPortfolioTokenVisualizer
.
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
Outdated
Show resolved
Hide resolved
Deploying sanguine-fe with Cloudflare Pages
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2832 +/- ##
===================================================
+ Coverage 23.56910% 25.71313% +2.14403%
===================================================
Files 679 709 +30
Lines 50842 52094 +1252
Branches 80 80
===================================================
+ Hits 11983 13395 +1412
+ Misses 37536 37323 -213
- Partials 1323 1376 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Removed console log statement in
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
- Used
formatAmount
utility function for balance display inpackages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (1)
Line range hint
35-42
: Omit unnecessaryelse
clauses.The
else
clauses can be omitted because the previous branches return early. This will simplify the code and improve readability.if (isDisabled) { return null } if (isGasToken && isGasEstimateLoading) { return ( <label className={labelClassName} htmlFor="inputRow"> <span className="animate-pulse text-zinc-500 dark:text-zinc-400"> calculating gas... </span> </label> ) } return ( <label className={labelClassName} htmlFor="inputRow"> <span className="text-zinc-500 dark:text-zinc-400">Available: </span> {formatAmount(maxBridgeableBalance?.toString()) ?? balance ?? '0.0'} </label> )Tools
Biome
[error] 27-42: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 35-42: This else clause can be omitted because previous branches break early.
(lint/style/noUselessElse)
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (2 hunks)
Additional context used
Biome
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx
[error] 27-42: This else clause can be omitted because previous branches break early.
Unsafe fix: Omit the else clause.
(lint/style/noUselessElse)
[error] 35-42: This else clause can be omitted because previous branches break early.
(lint/style/noUselessElse)
Additional comments not posted (1)
packages/synapse-interface/components/StateManagedBridge/AvailableBalance.tsx (1)
3-3
: LGTM! The import forformatAmount
is correct.The import statement for
formatAmount
from@/utils/formatAmount
is appropriate and aligns with the changes described.
This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- .codecov.yml: Added
carryforward: true
tocctp-relayer
flag for coverage data retention. - .yamllint.yml: Ignored
index.yaml
for YAML linting. - CONTRIBUTING.md: Advised using
fetch-depth: 2
for shallow clones in GitHub Actions. - README.md: Added 'Widget' package under Synapse Bridge section.
- agents/go.mod: Updated dependencies for improved compatibility and security.
164 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Summary by CodeRabbit
formatAmount
.GasTokenAsset
.PortfolioTokenVisualizer
to support chain-specific token balances viaportfolioChainId
prop.SingleNetworkPortfolio
to passportfolioChainId
toPortfolioTokenVisualizer
.maxBridgeableBalance
inAvailableBalance
by formatting withformatAmount
.de80720: synapse-interface preview link
71bd1a6: synapse-interface preview link
cef13dc: synapse-interface preview link